
<template>
    <el-table :data="tableData"  border @row-click="row_handle">
        <el-table-column prop="pid" label="PID" style="text-align: center" width="70 px"></el-table-column>
        <el-table-column prop="name" label="名字"></el-table-column>
        <el-table-column prop="time" label="时间"> </el-table-column>
    </el-table>
</template>


<script>
    export default {
        data() {
            return {
                tableData: [],
            }
        },
        methods:{
          row_handle:function (row) {
             console.log(row.pid)
          }
        },

        mounted:function () {
            this.$http.get('api/process_list').then((res) => {
                let tableData = []
                res.data.bizData.forEach(function (el) {
                    tableData.push({"pid":el[0],
                        "name":el.slice(3).join(),
                        "time":Number(el[2].split(":")[0])*3600+Number(el[2].split(":")[1])*60+Number(el[2].split(":")[2]),
                    })
                })
                tableData.sort(function (a,b) {
                    return  b.time - a.time
                })
                this.tableData = tableData
            })
        }
    }
</script>

<style scoped>

</style>